/**
 * 
 */
package com.sci.web.action.datareportseason;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import com.sci.web.action.util.BaseAction;
import com.sci.web.bean.Check_Log;
import com.sci.web.dao.DataCheckDao;
import com.sci.web.dao.DataReportM_BaseInfoDao;

/**
 * @author BaiFuyou
 * @date: Nov 11, 2011 11:18:14 AM
 * 
 * 企业提交数据进行科技厅初审
 */
public class UpdateEnterpriseStateForCheckAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1722482455372758532L;
	@Resource
	private DataReportM_BaseInfoDao dataReportM_BaseInfoDao;

	private int uid;
	private String year;
	private int type;

	/**
	 * @return the uid
	 */
	public int getUid() {
		return uid;
	}

	/**
	 * @param uid
	 *            the uid to set
	 */
	public void setUid(int uid) {
		this.uid = uid;
	}

	/**
	 * @return the year
	 */
	public String getYear() {
		return year;
	}

	/**
	 * @param year
	 *            the year to set
	 */
	public void setYear(String year) {
		this.year = year;
	}

	/**
	 * @return the type
	 */
	public int getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(int type) {
		this.type = type;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		int eid = dataReportM_BaseInfoDao.getEnterpriseId(uid);
		Check_Log cl = new Check_Log();
		cl.setDatetime(new Date());
		cl.setEid(eid);
		cl.setResult("等待科技局审核");
		cl.setType(type);
		cl.setWho("科技局");
		cl.setYear(year);
		dataReportM_BaseInfoDao.insertNewCheckLog(cl);
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("state", 1);
		Map<String, Object> map1 = new HashMap<String, Object>();
		map1.put("type", type);
		map1.put("year", year);
		map1.put("result", 0);
		map1.put("where_check_pass", 3);
		map1.put("eid", eid);
		System.out.println(map1);
		if (dataReportM_BaseInfoDao.updateEnterpriseStateForCheckBatch(map1, map)) {
			super.outPrint("ok");
		} else {
			super.outPrint("ok");
		}
		return "json";
	}

}
